/************************************
 * created by Tonk (tonk@ctonk.com) *
 ************************************/

// loginHandler.h

#ifndef LOGIN_HANDLER_H
#define LOGIN_HANDLER_H

#include "definitions.h"
#include <list>
#include "character.h"



class loginHandler {
	private:
		std::string		_name;
		std::string		_output;
		Character*		_c;
		int				_state;
		int				_flag;
		bool			checkName( Character*, const string& );
		bool			checkPassword( Character*, const string& );

	public:
		loginHandler();
		loginHandler( Character* );
		loginHandler( loginHandler& );
		~loginHandler();

		loginHandler& operator = ( loginHandler& );

		std::string&	getName();
		std::string&	getOutput();
		Character*		getC();
		int				getState();
		int				getFlag();
		bool			fire( Character*, const string& );
};

class loginList {
	// A container for the list of loginHandlers,
	// also provides functionality.
	private:
		std::list< loginHandler* >	_logins;

	public:
		std::list< loginHandler* >&	getLogins();
		void						act( Character*, const string& );
		static loginList&			Instance();
};

inline loginList& loginList::Instance() {
	static loginList instance;
	return instance;
}

#endif // #ifndef LOGIN_HANDLER_H
